/**
 * Created by wqz806687102 on 2016/1/13.
 */
'use strict';
angular.module('QC').controller('QCStandardListController', ['$scope', 'PublicModule', 'PublicEnum', 'PublicFunction', 'PublicService', '$location', 'Authentication',
    function($scope, PublicModule, PublicEnum, PublicFunction, PublicService, $location, Authentication) {
        PublicModule.initModule($scope, 'QCStandard');
        $scope.Module.QCStandard.LoadMode = PublicEnum.LoadMode.CacheAndPaging;
        $scope.Module.QCStandard.PageSize = 15;
        $scope.Module.QCStandard.QueryParameter.Populate = [{path: 'ItemMaster', select: 'Name'},{path: 'Work', select: 'Name'},{path: 'QCNorm', select: 'Name'}];
        $scope.ItemCategoryEnum;

        $scope.Module.QCStandard.load();

        PublicService.getExtendEnum('ItemCategory', function (extendEnum) {
            $scope.ItemCategoryEnum = extendEnum;
        });

        $scope.btnAdd = function(){
            $location.url('/index/QCStandard/Edit');
        };

        $scope.rowDblClick = function(){
            $scope.$apply(function(){
                $location.url("/index/QCStandard/Edit/" + $scope.Module.QCStandard.FocusedRecord._id);
            });
        };

        $scope.btnDelete = function(){
            $scope.Module.QCStandard.deleteSelecteds(function(){
                $scope.Module.QCStandard.load();
            });
        };
    }
]);
